package com.cskaoyan.converter;

import com.cskaoyan.bean.User;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

/**
 * 2 → two → to
 * log4j → four → for
 * @author stone
 * @date 2022/08/09 17:07
 */
@Component
public class StringToUserConverter implements Converter<String, User> {
    @Override
    public User convert(String s) {
        // String → User

        User user = new User();
        user.setUsername(s);
        user.setPassword(s);
        return user;
    }
}
